import logging
from flask import Flask, session

from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from info import creat_app, db
from config import DevelopmentConfig, ProductionConfig
from flask import current_app

app = creat_app(DevelopmentConfig)
# 创建Manager
manager = Manager(app)

# 创建迁移对象
Migrate(app, db)

# 给manager绑定迁移命令
manager.add_command('db', MigrateCommand)

# @app.route('/')
# def hello_world():
#     logging.debug('this is debug')
#     logging.info('this is info')
#     logging.warning('this is warning')
#     logging.error('this is error')
#     logging.fatal('this is fatal')
#     current_app.logger.error('current error')
#
#     # session['name'] = 'huizhubo'
#     return 'hello world'

if __name__ == '__main__':
    manager.run()